﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.peddler {
    import Engine.Classes.*;
    import Engine.Transactions.*;
    import Classes.*;
    import Display.*;

    public class TPlacePeddler extends Transaction {

        protected var m_params:Object;
        private var m_peddler:Peddler;
        private var m_peddlerSlidePick:PeddlerSlidePick;

        public function TPlacePeddler(_arg1:MapResource, _arg2:String, _arg3:PeddlerSlidePick){
            this.m_peddler = (_arg1 as Peddler);
            this.m_peddlerSlidePick = _arg3;
            this.m_params = new Object();
            this.m_params["x"] = this.m_peddler.getPosition().x;
            this.m_params["y"] = this.m_peddler.getPosition().y;
            this.m_params["direction"] = this.m_peddler.getDirection();
            this.m_params["peddlerId"] = this.m_peddler.peddlerId;
            this.m_params["recipientID"] = Global.world.ownerId;
            this.m_params["message"] = _arg2;
        }
        override public function perform():void{
            signedCall("VisitorService.placePeddler", this.m_params);
        }
        override protected function onAmfComplete(_arg1:Object):void{
            var _local2:String;
            var _local3:String;
            super.onAmfComplete(_arg1);
            if (this.m_peddler){
                if ((((null == _arg1.data.objectid)) || (("" == _arg1.data.objectid)))){
                    _local2 = _arg1.data.message;
                    _local3 = ZLoc.t("Dialogs", _local2);
                    UI.displayMessage(_local3);
                    this.m_peddler.detach();
                } else {
                    this.m_peddler.setId(_arg1.data.objectid);
                    this.m_peddler.cryoutMessage = _arg1.data.message;
                    this.m_peddler.setPick(this.m_peddlerSlidePick);
                };
            };
        }
        public function getWorldObject():WorldObject{
            return (this.m_peddler);
        }

    }
}//package Modules.peddler 
